<?php


namespace App\Http\Controllers\Admin;


use App\Base\BaseFunc;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class AdminController extends Controller
{
    public function adminLogin()
    {
        return view('/admin.adminLogin');
    }

    public function _adminLogin(Request $request,BaseFunc $baseFunc)
    {
        $adminName = $request['adminName'];
        $adminPassword = $request['adminPassword'];
        $name = '15242224324';
        $password = 'admin';
        if ($adminName == $name && $adminPassword == $password) {
            session(['admin_id' => 1]);
            $baseFunc->setRedirectMessage(true,'登录成功',NULL,'/addBookClass');
        } else {
            $baseFunc->setRedirectMessage(false,'登陆错误，请重新登陆！',NULL,'/adminLogin');
        }
    }

    public function addBookClass()
    {
        session(['adminNowAddress'=>'addBookClass']);
        return view('/admin.bookClass.addBookClass');
    }
}